LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

#opencv
include /home/yc/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED

# LOCAL_SRC_FILES := Grayprocess.cpp
LOCAL_MODULE := opencv

LOCAL_LDLIBS += -llog

include $(BUILD_SHARED_LIBRARY)


# change this folder path to yours
NCNN_INSTALL_PATH := /home/yc/ncnn/build-android/install
OPENCV_INSTALL_PATH := /home/yc/OpenCV-android-sdk/sdk/native/jni

include $(CLEAR_VARS)
LOCAL_MODULE := ncnn
LOCAL_SRC_FILES := $(NCNN_INSTALL_PATH)/lib/libncnn.a
include $(PREBUILT_STATIC_LIBRARY)

# source

include $(CLEAR_VARS)
LOCAL_MODULE := grayprocess
LOCAL_SRC_FILES := Grayprocess.cpp

LOCAL_C_INCLUDES := $(NCNN_INSTALL_PATH)/include
LOCAL_C_INCLUDES += $(OPENCV_INSTALL_PATH)/include

LOCAL_STATIC_LIBRARIES := ncnn
LOCAL_SHARED_LIBRARIES := opencv
LOCAL_SHARED_LIBRARIES += opencv_java

LOCAL_CFLAGS := -O2 -fvisibility=hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math
LOCAL_CPPFLAGS := -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math
LOCAL_LDFLAGS += -Wl,--gc-sections

LOCAL_CFLAGS += -fopenmp
LOCAL_CPPFLAGS += -fopenmp
LOCAL_LDFLAGS += -fopenmp

LOCAL_LDLIBS := -lz -llog -ljnigraphics

include $(BUILD_SHARED_LIBRARY)